<template>
  <BasicModal v-bind="$attrs" @register="registerModal" :showOkBtn="false" title="详情" width="40%">
    <Description
      v-if="errorInfo.ruleCode === 'LfsAscXslxProductTransformRule'"
      title="错误信息"
      :column="2"
      :data="errorInfo"
      :schema="schemaProduct"
    />
    <Description v-else title="错误信息" :column="2" :data="errorInfo" :schema="schemaOrg" />
  </BasicModal>
</template>

<script lang="ts" setup>
  import { BasicModal, useModalInner } from '/@/components/Modal';
  import { Description, DescItem } from '/@/components/Description/index';
  import { ref } from 'vue';
  const errorInfo = ref({});
  const schemaProduct: DescItem[] = [
    {
      field: 'originalProductId',
      label: '产品原始编码',
    },
    {
      field: 'orgName',
      label: '经销商名称',
    },
    {
      field: 'proName',
      label: '产品名称',
    },
    {
      field: 'proSpec',
      label: '产品规格',
    },
    {
      field: 'proUnit',
      label: '产品单位',
    },
    {
      field: 'productManu',
      label: '生产厂家',
    },
  ];
  const schemaOrg: DescItem[] = [
    {
      field: 'ownerName',
      label: '经销商名称',
    },
    {
      field: 'orgCode',
      label: '终端编码',
    },
    {
      field: 'orgName',
      label: '终端名称',
    },
  ];
  const [registerModal] = useModalInner((data) => {
    errorInfo.value = data;
  });
</script>

<style lang="less" scoped></style>
